package com.zzc.mcpclient.service;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

@Service
public class ChatService {
     private final ChatClient chatClient;

    public ChatService(ChatClient.Builder builder) {
        this.chatClient = builder.build();
    }

    public String sendMessage(String message){
        return chatClient.prompt(message).call().content();
    }

    public Flux<String> chat(String message){
        return chatClient.prompt(message).stream().content();
    }
}
